package cn.iocoder.yudao.module.course.dal.mysql.coursematerials;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.course.dal.dataobject.coursematerials.CourseMaterialsDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.course.controller.admin.coursematerials.vo.*;

/**
 * 课程素材 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CourseMaterialsMapper extends BaseMapperX<CourseMaterialsDO> {

    default PageResult<CourseMaterialsDO> selectPage(CourseMaterialsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CourseMaterialsDO>()
                .eqIfPresent(CourseMaterialsDO::getCourseId, reqVO.getCourseId())
                .eqIfPresent(CourseMaterialsDO::getMaterialId, reqVO.getMaterialId())
                .eqIfPresent(CourseMaterialsDO::getOrderIndex, reqVO.getOrderIndex())
                .orderByDesc(CourseMaterialsDO::getId));
    }

}